$(function () {

    //加载
    $("#sksh_fkfs").fkfssjzdcombobox("fkfs");
    $("#sksh_startDate").datebox();
    $("#sksh_endDate").datebox();
    $("#sksh_khfksj").datebox();
    //款项类型
    $("#form_sksh").find("[idVal='sksh_kxsy_id']").sjzdcombobox("kxsy");

    $("#form_sksh_kxtz").find("[idVal='sksh_kxsy_id']").sjzdcombobox("kxsy");

    $("#form_sksh_kxhz").find("[idVal='sksh_kxsy_hz_id']").sjzdcombobox("kxsy");

    //票据类型
    $("#form_sksh").find("[idVal='sksh_pjlx_id']").sjzdcombobox("pjlx");

    //回款类型
    $("#form_sksh").find("[idVal='sksh_hklx_id']").sjzdcombobox("hklx");

    $("#form_hzkx_kxhz").find("[idVal='hzkx_kxsy_hz_id']").sjzdcombobox("kxsy");


    $("#sksh_gldw_id").skczgsjgqczcombobox($("#sksh_jfejzh_id"), $("#sksh_gs_id"), {
        onSuccess: function () {
            $("#sksh_gldw_id").zcombobox("setMap", { id: $("#sksh_id").val(), qc: $("#sksh_jc").val()})
        }
    });


    //供应商与客户之间的切换（关联企业）
    $(function () {
        var type = $("[name='sksh.sfklx']:checked").val();
        if (type == 3) {
            $("#sksh_kh").css("display", "block");
            $("#sksh_gys").css("display", "none");
            $("#sklx3").css("display", "inline");
            $("#sklx4").css("display", "inline");
            $("#sklx1").css("display", "none");
            $("#sklx2").css("display", "none");
        } else {
            $("#sksh_kh").css("display", "none");
            $("#sksh_gys").css("display", "block");
            $("#sklx3").css("display", "none");
            $("#sklx4").css("display", "none");
            $("#sklx1").css("display", "inline");
            $("#sklx2").css("display", "inline");
        }
        $("[name='sksh.sfklx']").change(function () {
            var type = $(this).val();
            if (type == 3) {
                $("#sksh_kh").css("display", "block");
                $("#sksh_gys").css("display", "none");
                $("#sklx3").css("display", "inline");
                $("#sklx4").css("display", "inline");
                $("#sklx1").css("display", "none");
                $("#sklx2").css("display", "none");
            } else {
                $("#sksh_kh").css("display", "none");
                $("#sksh_gys").css("display", "block");
                $("#sklx3").css("display", "none");
                $("#sklx4").css("display", "none");
                $("#sklx1").css("display", "inline");
                $("#sklx2").css("display", "inline");
            }
        });
    });
});

